Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sunz normalization for viirs_compact #108

Merged
merged 3 commits into from
Jan 30, 2025

Conversation

ninahakansson
Copy link
Collaborator

@ninahakansson ninahakansson commented Jan 24, 2025

SDR data has sun_zenith_angle_correction_applied as default, viirs_compact does not! We now read data with the sunz_corrected modifier and satpy applyes the normalization. Note that reflective bands are
read separately to avoid sunz_correction applied to the IR channels.

SDR data has sun_zenith_angle_correction_applied as default,
viirs_compact does not! We now read data with the sunz_corrected modifier
and satpy applyes the normalization. Note that reflective bands are
 read separately to avoid sunz_correction applied to the IR channels.
scene[band].attrs['sun_zenith_angle_correction_applied'] = 'True'
if "sunz_corrected" not in scene['M05'].attrs['modifiers']:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why checking just M05? Maybe more clear if you move this check to line 156 and do an assert there (if we do not trust satpy):

assert "sunz_corrected" in scene['M05'].attrs['modifiers']

Or I would recommend that you remove this check and add a new input parameter named sun_zenith_angle_correction_applied to this function so it looks something like this:

def set_header_and_band_attrs(scene, sun_zenith_angle_correction_applied, orbit_n=0):
    if sun_zenith_angle_correction_applied:
        scene[band].attrs['sun_zenith_angle_correction_applied'] = 'True'

Then you can probably remove the comments on line 117 and 118 as well. To me comments is an indication that the code can be written more clear than presently.

and e.g. one line 156 and 159 you can add the following line:

sun_zenith_angle_correction_applied = True

Use the modifiers to set the sunz-correction attribute already in the main attribute function.
@coveralls
Copy link

coveralls commented Jan 30, 2025

Pull Request Test Coverage Report for Build 13050156252

Details

  • 1 of 6 (16.67%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.1%) to 78.146%

Changes Missing Coverage Covered Lines Changed/Added Lines %
level1c4pps/init.py 1 2 50.0%
level1c4pps/viirs2pps_lib.py 0 4 0.0%
Totals Coverage Status
Change from base Build 12688079447: -0.1%
Covered Lines: 1648
Relevant Lines: 2061

💛 - Coveralls

@ninahakansson ninahakansson marked this pull request as ready for review January 30, 2025 12:59
@ninahakansson ninahakansson merged commit eff499d into foua-pps:main Jan 30, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VIIRS compact reflectances not sun normalized
3 participants